﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif 
using System;
namespace SpaceDFramework
{ 
    /// <summary>
    /// 导出Unity包工具
    /// </summary>
    public class GenerateUnityPackage
    {
        public static string exportPath;
#if UNITY_EDITOR
        [MenuItem("SpaceD/生成Unity资源包  %e",false,1)]
        //快捷键control+e
        static void ExportPackage()
        {
            exportPath = Application.dataPath + "/../";
            bool exportsuccess= Exporter.ExportPackage(ref exportPath, Exporter.GenerateUnityPackageName(), "unitypackage");
            if (exportsuccess)
                EditorUtil.FileOpener.OpenURL(exportPath);
            else
                CommonUtil.LogWarning("导出取消");
        }
#endif
#if UNITY_EDITOR
        [MenuItem("SpaceD/生成带版本号的Unity资源包  %g", false, 2)]
        static void ExportReleasePackage() {
            exportPath = Application.dataPath + "/../";
            bool exportsuccess = Exporter.ExportPackage(ref exportPath, Exporter.GenerateUnityPackageNameVersion(), "unitypackage");
            if (exportsuccess)
                EditorUtil.FileOpener.OpenURL(exportPath);
            else
                CommonUtil.LogWarning("导出取消");
        }
#endif
    }
}
